﻿<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
    <title>商品列表</title>
    <link href="${pageContext.request.contextPath}/css/houtaimain.css" rel="stylesheet" type="text/css">
    <link href="${pageContext.request.contextPath}/bstable/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="${pageContext.request.contextPath}/bstable/css/bootstrap-table.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="tabe_div">

        <form class="p_line text_ient " action="${pageContext.request.contextPath}/product/getProductAllByName" method="post"><a class="find_a">按名称：</a><input type="text" class="form_input text_ient" name="p_name" placeholder="输入名称"/>

            <input type="submit" value="查询" class="but_find"/></form> </p>
        <form action="${pageContext.request.contextPath}/product/getProductByType" method="post">
    按类型：  <select class="form_select"  name="t_id"  style="padding-left: 1%;">
                <c:forEach items="${list}" var="list">
                    <option value="${list.t_id}">${list.type}</option>
                </c:forEach>
            </select>

        <input type="submit" value="查询" class="but_find"/>
</form>
    <table id="table" class="table_style" style="margin: 0 auto" >
            <c:forEach items="${products}" var="products">
        <tr>
            <td>${products.pid}</td>
            <td>${products.p_name}</td>
            <td>${products.productType.type}</td>
                <td>${products.price}</td>
            <td> <img src="${products.photo}" style="height: 40px;width: 60px"></td>

                <td>${products.time}</td>
                <td>${products.phone}</td>
                <td>${products.user.nickname}</td>
                <td> <a  onclick="if(confirm('是否删除?')){return true;}else{return false;}"href="${pageContext.request.contextPath}/product/delete?pid=${products.pid}"><strong>删除</strong></a></td>
                </tr>
            </c:forEach>
    </table>





</div>
<div></div>
<script src="${pageContext.request.contextPath}/js/jquery.js"></script>
<script src="${pageContext.request.contextPath}/js/date/js/laydate.js"></script>
<script src="${pageContext.request.contextPath}/bstable/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/bstable/js/bootstrap-table.js"></script>
<script src="${pageContext.request.contextPath}/bstable/js/bootstrap-table-zh-CN.min.js"></script>
<script>
    !function () {
        laydate.skin('danlan'); //切换皮肤，请查看skins下面皮肤库
        laydate({ elem: '#demo' });
        laydate({ elem: '#demo1' }); //绑定元素
    } ();
</script>

<script type="text/javascript">
    $(function() {
        $('#table')
            .bootstrapTable({
                method: "get",
                striped: true,
                singleSelect: false,

                dataType: "json",
                pagination: true, //分页
                pageSize: 10,
                pageNumber: 1,
                search: false, //显示搜索框
                contentType: "application/x-www-form-urlencoded",
                queryParams: null,
                columns: [
                    {
                        title: "ID",
                        field: 'id',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '名称',
                        field: 'name',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '类型',
                        field: 'type',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '价格',
                        field: 'price',
                        align: 'center'
                    },
                    {
                        title: '图片',
                        field: 'photo',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '上架时间',
                        field: 'buildTime',
                        align: 'center'
                    },
                    {
                        title: '联系电话',
                        field: 'phone',
                        align: 'center'
                    },

                    {
                        title: '发布人',
                        field: 'username',
                        align: 'center'
                    },
                    {
                        title: '操作',
                        field: 'oper',
                        align: 'center',

                    }
                ]
            });
    });

    function addHotel() {
        this.location.href = "addHotel.html";
    }

    function editHotel(id) {
        this.location.href = "addHotel.html";
    }

</script>
<script src="../../../layer_v2.1/layer/layer.js"></script>
<script type="text/javascript">
    function openlayer(id) {
        layer.open({
            type: 2,
            title: '添加信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: 'addHotel.html'
            //iframe的url
        });
    }

    //    function editHotel(id) {
    //        layer.open({
    //            type: 2,
    //            title: '酒店信息',
    //            shadeClose: true,
    //            shade: 0.5,
    //            skin: 'layui-layer-rim',
    //            //            maxmin: true,
    //            closeBtn: 1,
    //            area: ['80%', '75%'],
    //            shadeClose: true,
    //            closeBtn: 1,
    //            content: 'editHotel.html'
    //            //iframe的url
    //        });
    //    }

    function deleteHotel(dom) {
        alert("删除成功");
        $(dom).parent().parent().remove();
    }

    function showHotelInfo(id)
    {
        layer.open({
            type: 2,
            title: '酒店信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: 'addHotel.html'
            //iframe的url
        });
    }
</script>
</body>
</html>
